﻿using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using CommonHelper;
using System.Diagnostics;
using System.Linq;
using System.Collections.Generic;

namespace CommonSite.Tests
{
    [TestClass]
    public class UnitTest2
    {
        public static long Takes(Action action)
        {
            Stopwatch watch = new Stopwatch();
            watch.Start();
            action();
            return watch.ElapsedMilliseconds;
        }

        [TestMethod]
        public void TestMethod1()
        {
            var args = new List<string>();
            for (int i = 0; i < 100000; i++)
            {
                args.AddRange(new string[] {
                "21kd2",
                "21kd2",
                "21kd2",
                "21kd2",
                "21kd221kd221kd2",
                "21kd2",
                "21kd221kd221kd221kd221kd221kd221kd2",
                "21kd2",
                "21kd2",
                "21kd2",
                "21kd2",
                "21kd221kd221kd221kd2",
                "21kd2", });
            }

            long takes1 = Takes(() =>
            {
                args.AsEnumerable().Join("&&");
            });

            long takes2 = Takes(() =>
            {
                string.Join("&&", args.AsEnumerable());
            });

            Assert.Inconclusive("Func1 = {0}, Func2 = {1}\n", takes1, takes2);
        }
    }
}
